//
//  HECheckItemCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/12/23.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HECheckItemCell.h"
#import "HECusCheckItemModel.h"

@interface HECheckItemCell ()

@property (nonatomic, strong) UILabel *titleLb;

@property (nonatomic, strong) UILabel *contentLb;

@end

@implementation HECheckItemCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self initUI];
    }
    return self;
}

- (void)initUI {

    UIView *warp = [UIView new];
    warp.backgroundColor = CSplitLineColor;
    [self.contentView addSubview:warp];
    
    _titleLb = [UILabel new];
    _titleLb.text = @"检测结果";
    _titleLb.font = DYFont(16);
    [warp addSubview: _titleLb];
 
 
    _contentLb = [UILabel new];
    _contentLb.text = @"-";
    _contentLb.font = DYFont(16);
    _contentLb.textColor = CNavLightBlackColor;
    _contentLb.numberOfLines = 0;
    [warp addSubview: _contentLb]; 
    
    [warp mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(0);
        make.left.equalTo(self.contentView).mas_offset(10);
        make.right.equalTo(self.contentView).mas_offset(-10);
        make.bottom.equalTo(self.contentView).mas_offset(-0);
    }];
    
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(warp).mas_offset(10);
        make.left.equalTo(warp).mas_offset(15);
    }];
    [_titleLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
   
    _contentLb.preferredMaxLayoutWidth = KScreenWidth - 20 - 20 - 10 - [_titleLb.text widthForFont:_titleLb.font];
   
    [_contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(warp).mas_offset(10);
        make.left.equalTo(_titleLb.mas_right).mas_offset(0);
        make.right.equalTo(warp).mas_offset(-10);
        make.bottom.equalTo(warp.mas_bottom);
    }];

}

- (void)configCellWithModel:(HECusCheckItemModel *)model {
    _titleLb.text = model.title;
    _contentLb.text = model.content;
    _contentLb.textColor = model.contentColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
